<?php

declare (strict_types=1);
namespace App\Model;

use App\Helpers\Utils;
use Hyperf\DbConnection\Model\Model;
use Hyperf\ModelCache\Cacheable;
use Hyperf\ModelCache\CacheableInterface;

class Config extends Model implements CacheableInterface
{
    use Cacheable;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'configs';

    public function getConfigAttribute($key)
    {
        if ($key){
            return Utils::JsontoArray($key);
        }
        return [];
    }
}